package Cantella::DJabberd::Web::UI::ViewPort::Static;

use Reaction::Class;
extends 'Reaction::UI::ViewPort';

has file_name => ( is => 'rw');
has content   => ( is => 'rw', lazy_build => 1);

sub _build_content {
  my $self = shift;
  confess "attribute file_name needed to lazy build content"
    unless $self->has_file_name;
  my $path = $self->ctx->path_to('share','content');
  my $cand = $path->file($self->file_name);
  return $cand->slurp if $cand->stat;
  confess "Failed to find or open file_name $cand";
}

__PACKAGE__->meta->make_immutable;

1;
